<?php
/*
	插件链接选择页面
*/
defined('BY_JYA') or exit('error');
//系统链接获取接口
$return=array();
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$tabs=array(
	array('op'=>'system','plugin'=>'core','action'=>'tools.link','title'=>'系统页面链接'),
	array('op'=>'list','title'=>'插件页面'),
	array('op'=>'goodslist','title'=>'项目分类'),
);
if($_RQ['op']=='list'){
	$return['list']=array(
		array('title'=>'首页','url'=>'jy_merchfuwu/index//current_plugin=jy_merchfuwu'),
		array('title'=>'全部服务','url'=>'jy_merchfuwu/shop.groups//current_plugin=jy_merchfuwu'),
		array('title'=>'服务订单','url'=>'jy_merchfuwu/order.list//current_plugin=jy_merchfuwu'),
		array('title'=>'我的','url'=>'jy_merchfuwu/member.index/'),
		array('title'=>'商品分类','url'=>'jy_merch/shop.group/'),
		array('title'=>'服务分类','url'=>'jy_mfuwu/app.shop.groups/'),
		array('title'=>'项目中心','url'=>'jy_mfuwu/app.goods.index/'),
		array('title'=>'购物车','url'=>'jy_merch/member.cart/'),
		array('title'=>'订单中心','url'=>'jy_merch/order.list/'),
		array('title'=>'会员中心','url'=>'jy_merchfuwu/member.index/'),
		array('title'=>'师傅个人中心','url'=>'jy_shifu/index/'),
		array('title'=>'师傅申请入口','url'=>'jy_shifu/apply/'),
		array('title'=>'二级分销入口','url'=>'jy_mfee/index/'),
		array('title'=>'团队分销入口','url'=>'jy_mteamfee/index/'),
		array('title'=>'区域代理入口','url'=>'jy_mareafee/index/'),
		array('title'=>'出局分润入口','url'=>'jy_merch2fee/index/'),
		array('title'=>'大转盘入口','url'=>'jy_bigwheel/index/'),
		array('title'=>'砍价入口','url'=>'jy_bargain/index/'),
		array('title'=>'拼团入口','url'=>'jy_pingdd_pin/index/'),
	);
	$htmls=array(
		'type'=>'list',
		'tabs'=>$tabs,
		'list'=>array('data'=>'list','edit'=>false,'delall'=>false,'del_one'=>false,'pagelist'=>false,'list'=>array(
			array('name'=>'title','title'=>'标题','type'=>'string'),
			array('name'=>'url','title'=>'H5路径','type'=>'string'),
		),'action'=>array(
			array('type'=>'modal_result','name'=>'url','title'=>'选取'),
		)),
		'search_one'=>array('name'=>'title','add'=>false),
	);
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='goodslist'){
	$params=array('uniacid'=>$_SESSION['uniacid'],'mid'=>0,'parentid'=>0,'onepluginname'=>'jy_merchfuwu');
	if(!empty($_RQ['title'])){
		$params['title like']='%'.trim($_RQ['title']).'%';
		$return['params']['title']=$_RQ['title'];
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$fields=array('id','parentid','onepluginname','pluginname','uniacid','title','isshow','isrecommand','image','paixu');
	$list=pdo_getslice('jy_weishop_goods_group',$params,array($pindex,$psize),$total,$fields,'','id desc');
	if($list){
		foreach($list as &$item){
			$item['url']='jy_merchfuwu/shop.groups//pid='.$item['id'];
		}
	}
	$return['list']=$list;
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$htmls=array(
		'type'=>'list',
		'tabs'=>$tabs,
		'list'=>array('data'=>'list','edit'=>false,'delall'=>false,'del_one'=>false,'pagelist'=>false,'list'=>array(
			array('name'=>'title','title'=>'标题','type'=>'string'),
			array('name'=>'image','title'=>'图片','type'=>'image'),
			array('name'=>'url','title'=>'短地址','type'=>'string'),
		),'action'=>array(
			array('type'=>'modal_result','name'=>'url','title'=>'选取'),
		)),
		'search_one'=>array('name'=>'title','add'=>false),
	);	
	$return['htmls']=$htmls;
	exi($return);
}
?>